<template>
  <h3>孙组件</h3>
  <button @click="sendNotify">发送通知消息</button>
</template>

<script>
export default {
  emits: ['sonNotify'],
  setup(props, context) {

    function sendNotify(){
      let dt = new Date()
      let s  = dt.toLocaleDateString() + ' ' + dt.toLocaleTimeString()
      context.emit('sonNotify', `这是来自内嵌的孙组件的通知消息~~~ @ (${s})`)
    }

    return {sendNotify}
  },
}
</script>

<style scoped>
  h3 {
    text-align: center;
  }

  button {
    margin-left: 10px;
    margin-bottom: 5px;
  }
</style>